import path from "path";
// import path1 from "node:path";
import process from "process";
import url from "url";
import { findUpSync } from "find-up";
// import {
//   getPackages as getPackagesFunc,
//   getPackagesSync as getPackagesSyncFunc,
// } from '@manypkg/get-packages';

const r = process.cwd();
const x = path.resolve(r, "/x");

export type PackageAccessType = "public" | "restricted";

/**
 * 查找大仓根目录
 * @returns
 */
// export function findMonorepoRoot() {
//     const lockFile = findUpSync("pnpm-lock.yaml")
//     return dirname(lockFile || "")
// }

/*


/**
 * 获取大仓的所有包
 *
function getPackagesSync() {
  const root = findMonorepoRoot();
  return getPackagesSyncFunc(root);
}

/**
 * 获取大仓的所有包
 *
async function getPackages() {
  const root = findMonorepoRoot();

  return await getPackagesFunc(root);
}

/**
 * 获取大仓指定的包
 *
async function getPackage(pkgName: string) {
  const { packages } = await getPackages();
  return packages.find((pkg) => pkg.packageJson.name === pkgName);
}

export { findMonorepoRoot, getPackage, getPackages, getPackagesSync };
*/
export {};
